/*
 * @description: 
 * @Date: 2022-10-05 13:25:28
 * @LastEditTime: 2022-12-18 17:54:13
 */
import * as path from 'path';
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
export default defineConfig({
    plugins: [vue()],
    base: '/',
    publicPath: "./",
    resolve: {
        alias: {
            "@": path.resolve(__dirname, "./src"), //运行目录地址
            "@s": path.resolve(__dirname, "./src/assets"), //图片资源地址
            "Sortable": path.resolve(__dirname, "./src/assets/js/sortable.js"),
            "html2canvas": path.resolve(__dirname, "./src/assets/js/html2canvas.js"),
        },
    },
    optimizeDeps: {
        include: ["axios"],
    },
    build: {
        chunkSizeWarningLimit: 2000,
        minify: "terser",
        outDir: "web",
        assetsDir: "static",
        publicPath: './'
    },
    server: {
        host: "0.0.0.0", // ← 新增内容 ←
        port: 3000,
        proxy: {
            '/api': {
                target: "http://127.0.0.1:8000/",
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ""),
            }
        }
    },
    css: {
        preprocessorOptions: {
            scss: {
                charset: false,
            },
        },
        css: {
            postcss: {
                plugins: [require('tailwindcss'), require('autoprefixer')],
            },
        },
    },
});
